package tichu_project252.View.Buttons;

import javax.swing.JLabel;
/** 
 *  This class implements the label of score.
 *
 * This class sets a label, and everytime the score is updated the label changes
 *
 * @see <a
 * href="http://docs.oracle.com/javase/6/docs/api/javax/swing/JLabel.html">JLabel</a>
 *
 * @author Alexandra Barka, ΑΜ: 2867, login : barka.
 * @version %I%, %G%
 *
 */
public class ScoreLabel extends JLabel {
    private int scoreA = 0;         // The score of first team
    private int scoreB = 0;         //the score of second team
    /**
     *
     * Constructs a new Score Label..
     *
     * <p><b>Constructor: </b> ScoreLabel()  </p>
     *
     * <p><b>Precondition: </b> </p> <p><b>Postcondition: </b> Constructs a new
     * JLabel </p>
     *
     *
     */
    public ScoreLabel() {
        super("Score: Team A: 0 points, Team B: 0 points"); //sets the score of the teams
    }
 
    /**
     * Updates the score of the teams.
     * 
     * <p><b>Transformer: </b> update(int a, int b) </p>
     * @param a Team a score
     * @param b Team b score
     */
    public void update(int a, int b) {
        int newA = a;
        int newB = b;
        String text = "Score: Team A: " + newA +  " points, Team B: " + newB + " points";
        this.setText(text);
    }

}
